-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Improved the build process for cpprestsdk on Android #714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The Android configure.sh shell script and CMake build files have been updated for cpprestsdk on Android with the following changes: - Added new --api and --stl command line switches to the Android_build/configure.sh shell script that control the Android API level and C++ runtime to build against. - Use the base CMake toolchain configuration files that come with Android NDK r13b and later if they are available (requires CMake 3.6 or later to be installed on host system), otherwise fallback fallback to using the older third-party android-cmake. - Fix a few compilation errors when building with libc++ on Android, namely to do with assumptions of using libstdc++ paired with checked the ANDROID or __ANDROID__ preprocessor symbols. - Make use of the new features added in subsequent PRs for building OpenSSL and Boost for Android. Note that cpprestsdk seems to no longer build with libstdc++ 4.8 or 4.9 library headers that ship with the Android NDKs due to the use of std::to_string introduced in commit 6397261 so the default C++ runtime has been changed to c++_static in configure.sh for the time being. This problem can probably be fixed in a separate patch, as its outside of the scope of this one.
the versions of these packages that are downloaded and built. Furthermore, the default version of Boost has been upgraded to 1.59.0 as Boost 1.55.0 is no longer used by the Xbox Live SDK on Android.
|
Can we have some update on this PR? I am trying to build cpprest for android and facing issues while building. @jwtowner Were you able to successfully build against > ndk 14 (Specially latest change with gcc to clang after ndk 16) |
|
@aksswami Yes, I was able to build against NDK r14b, but I had not with libstdc++ 4.9, you need to switch over to libc++ due to the use of std::to_string now. Unfortunately, the libc++ in r14b is stuck a v3.9. Recommend use NDK r17 if possible or maybe modifying cpprestsdk to not use std::to_string. |
|
@jwtowner Sorry for the delay here -- I'm trying to take over this thing now and get Android builds added to continuous integration. It looks like Android builds are totally broken before these PRs, and things work OK if I apply all of them. Do you mind if that's applied as a single PR (here) and changes to add that to CI at the same time? Thanks for the help! |
This merges parts of: * PR microsoft#662 "Overhaul the build process for the OpenSSL dependency on Android" by jwtowner * PR microsoft#711 "Update the build process for Boost on Android", also by jwtowner * PR microsoft#714 "Improved the build process for cpprestsdk on Android", also by jwtowner. The changes which required patching upstream Boost-for-Android in those PRs has been stripped. The NDK version targeted has been updated to 17c because that's what's avaialble in Azure Pipelines. Various compile failures this uncovered in cpprestsdk on Android were fixed.
* PR microsoft#662 "Overhaul the build process for the OpenSSL dependency on Android" by jwtowner * PR microsoft#711 "Update the build process for Boost on Android", also by jwtowner * PR microsoft#714 "Improved the build process for cpprestsdk on Android", also by jwtowner. The changes which required patching upstream Boost-for-Android in those PRs has been stripped. The NDK version targeted has been updated to 17c because that's what's avaialble in Azure Pipelines. Various compile failures this uncovered in cpprestsdk on Android were fixed.
* This merges parts of: * PR #662 "Overhaul the build process for the OpenSSL dependency on Android" by jwtowner * PR #711 "Update the build process for Boost on Android", also by jwtowner * PR #714 "Improved the build process for cpprestsdk on Android", also by jwtowner. The changes which required patching upstream Boost-for-Android in those PRs has been stripped. The NDK version targeted has been updated to 17c because that's what's avaialble in Azure Pipelines. Various compile failures this uncovered in cpprestsdk on Android were fixed. * Added Jesse Towner (jwtowner) to contributors.
|
You caught me on vacation! Just getting back up to speed right now. Looks like you did the right thing in applying all of the PRs. We've been using this downstream for some time on Microsoft Solitaire Collection and few other projects in tandem with the XBox Live SDK, in order for us to use C++17 with NDK r15c and r16b when targeting Android. We will probably move to r17c or beyond when that becomes more viable with VS2019. As far as applying things upstream for Boost-For-Android, that's certainly a possibility but I have not reached out to the project retainer there. It looked like cpprestsdk had originally made modifications to it in its patch regardless so that felt like the best way to go for our needs. If you have any further questions, I'd be more than happy to help clarify things. |
Right, I agree that made sense then. Now that we don't need to modify things any longer I would prefer to stay out of that business. Do you mind if I mark these PRs closed now that we have regular Android builds in Azure Pipelines? |
Yes, I think it's safe to close them. Thanks for getting this merged in! |
|
No, thank you for the contribution, and sorry it took so long :) |
IMPORTANT: This PR should be applied only after PR #662 and #711
have first been applied.
The Android configure.sh shell script and CMake build files have
been updated for cpprestsdk on Android with the following changes:
Build_android/configure.sh shell script that control the Android
API level and C++ runtime to build against.
of Boost and OpenSSL to be specified.
Android NDK r13b and later if they are available (requires CMake
3.6 or later to be installed on host system), otherwise fallback
to using the older third-party android-cmake.
namely to do with assumptions of using libstdc++ when the
ANDROID or __ANDROID__ preprocessor definitions are defined.
building OpenSSL and Boost for Android.
Note that cpprestsdk seems to no longer build with libstdc++ 4.8
or 4.9 library headers that ship with the Android NDKs due to the
use of std::to_string introduced in commit 6397261 so the default C++
runtime has been changed to c++_static in configure.sh for the time
being. This problem can probably be fixed in a separate patch, as its
outside of the scope of this PR.
Since the Xbox Live SDK is using Boost 1.59.0 on Android instead of
1.55.0, the configure script has been modified to use this version as
well by default.